<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin.php");
if($_POST['act_xg']){
 
$c_rs_1=mysql_query("select * from jm_catalog where id='$_POST[catalog_1]'");
$c_row_1=mysql_fetch_array($c_rs_1);
$c_rs_2=mysql_query("select * from jm_catalog where id='$_POST[catalog_2]'");
$c_row_2=mysql_fetch_array($c_rs_2);
$catalog_1=($_POST[catalog_1])?$_POST[catalog_1]:0;
$catalog_2=($_POST[catalog_2])?$_POST[catalog_2]:0;

@mysql_query("update jm_list set j_title='$_POST[j_title]',type_id1='$catalog_1',type_name1='$c_row_1[cat_name]',type_id2='$catalog_2',type_name2='$c_row_2[cat_name]',j_info='$_POST[info]',picture='$_POST[picture]',j_pinpai='$_POST[pinpai]',j_price='$_POST[price]',j_bzj='$_POST[bzj]',j_ztze='$_POST[ztze]',j_ppfyd='$_POST[ppfyd]',j_ppls='$_POST[ppls]',j_qdl='$_POST[qdl]',j_fhqx='$_POST[fhqx]',j_scjhje='$_POST[scjhje]',j_ghzl='$_POST[ghzl]',j_fzms='$_POST[fzms]',j_hzfs='$_POST[hzfs]',j_ghzk='$_POST[ghzk]',j_khhbl='$_POST[khhbl]',j_lsjgdw='$_POST[lsjgdw]',j_mbxfqt='$_POST[mbxfqt]',j_yjhbl='$_POST[yjhbl]',j_yjhbzq='$_POST[yjhbzq]',j_txqsyf='$_POST[txqsyf]',j_htqx='$_POST[htqx]',j_jmszs='$_POST[jmszs]',j_txjysj='$_POST[txjysj]',j_cl=0 where id='".$_POST['iid']."'");

echo "<script>alert('修改成功');location='".$_POST['urls']."';</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<body>
<script language = "JavaScript">    
<?php
$rs1=mysql_query("select * from jm_catalog order by id asc");
?>
var onecount;
onecount=0;
subcat=new Array();
<?php
$count1=0;
while($row1=mysql_fetch_array($rs1)){?>
subcat[<?=$count1?>]=new Array("<?=$row1[cat_name]?>","<?=$row1[cat_id]?>","<?=$row1[id]?>");
<?php
$count1=$count1+1;}?>
onecount=<?=$count1?>;  
//联动函数    
function changelocation(locationid){   
   document.form1.catalog_2.length=0;     
   var locationid=locationid;   
   var i;   
   for(i=0;i<onecount;i++){   
       if(i==0){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option("--二级分类--","");
		  }   
       if(subcat[i][1]==locationid){     
          document.form1.catalog_2.options[document.form1.catalog_2.length]=new Option(subcat[i][0],subcat[i][2]);   
          }                   
    }   
}
</script>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 代理加盟 &gt;&gt; 修改代理加盟</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">修改代理加盟信息</TD>
   </TR>
</TABLE>
<br>
<?php 
$j_rs=@mysql_query("select * from jm_list where id='".$_GET['xg_id']."' and member_id='".$_COOKIE['user_id']."'");
$j_row=@mysql_fetch_array($j_rs);
?>
<TABLE width="100%" border="0" cellpadding="0" cellSpacing="1" bgcolor="#C1DCF5">
        <TBODY>
        <form method="post" action="" name="form1" onSubmit="return checkform()">
          <TR>
            <td width="17%" height="25" align="center" bgcolor="#EFF6FF">代理加盟标题&nbsp;<font color="#FF0000">*</font></td>
            <TD width="83%" bgcolor="#F9F9F9" style="padding-left:4px;"><input name="j_title" id="j_title" value="<?=$j_row[j_title]?>" type="text" size="50" maxlength="120"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">代理加盟目录<span style="padding-left:4px;line-height:35px;">&nbsp;<font color="#FF0000">*</font></span></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;line-height:35px;">

<select name="catalog_1" id="catalog_1" onChange="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
 <option value="">--选择大类--</option>   
<?php
$rrs=mysql_query("select id,cat_name from jm_catalog where cat_id=0 order by id asc");    
while($rrow=mysql_fetch_array($rrs)){   
?>     
 <option value="<?=$rrow[id]?>" <?php if($j_row[type_id1]==$rrow[id]){echo "selected";}?>><?=$rrow[cat_name]?></option><?php }?>
</select>&nbsp;<select name="catalog_2" id="catalog_2" onFocus="changelocation(document.form1.catalog_1.options[document.form1.catalog_1.selectedIndex].value)">
  <option value="">--选择二级分类--</option>
  <?php if($j_row[type_id2]){?>
    <option value="<?=$j_row[type_id2]?>" selected="selected"><?=$j_row[type_name2]?></option>
  <?php }?>
</select></TD>
          </TR>		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">描述&nbsp;<font color="#FF0000">*</font></td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><textarea name="info" id="info" cols="70" rows="20"><?=$j_row[j_info]?></textarea></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">图片</td>
            <TD bgcolor="#F9F9F9" style="padding:4px;line-height:30px;"><input name="picture" id="picture" type="text" size="35" maxlength="100" value="<?=$j_row[picture]?>">&nbsp;&nbsp;<input name="button" type="button" onClick="window.open ('../upfile.php', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" value="上传图片">
              (图片限制140*104)<br>
              <input type="button" onClick="window.open ('/member/photo/info.php', 'newwindow', 'height=500, width=600, top=0, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" value="选择已上传的图片"></TD>
          </TR>
		  <TR>
            <td height="25" colspan="2" align="left" bgcolor="#EFF6FF"><STRONG>参数<font color="#FF0000">(请认真完善以下资料，否则您的信息将直接删除)</font></STRONG></td>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">产品品牌</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="pinpai" id="pinpai" value="<?=$j_row[j_pinpai]?>" type="text" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">加盟费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;">
			<select name="price" id="price">
			 <option value="">--选择金额--</option>
		     <option value="免费" <?php if($j_row[j_price]=="免费"){echo "selected";}?>>免费</option>
		     <option value="0-1万" <?php if($j_row[j_price]=="0-1万"){echo "selected";}?>>0-1万</option>
		     <option value="1-5万" <?php if($j_row[j_price]=="1-5万"){echo "selected";}?>>1-5万</option>
		     <option value="5-10万" <?php if($j_row[j_price]=="5-10万"){echo "selected";}?>>5-10万</option>
		     <option value="10-25万" <?php if($j_row[j_price]=="10-25万"){echo "selected";}?>>10-25万</option>
		     <option value="25-40万" <?php if($j_row[j_price]=="25-40万"){echo "selected";}?>>25-40万</option>
		     <option value="50万以上" <?php if($j_row[j_price]=="50万以上"){echo "selected";}?>>50万以上</option>
        </select></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">保证金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="bzj" id="bzj" value="<?=$j_row[j_bzj]?>" type="text" size="10" maxlength="5">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">总投资额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ztze" id="ztze"  value="<?=$j_row[j_ztze]?>" type="text" size="10" maxlength="6">
            万元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">品牌发源地</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppfyd" id="ppfyd" type="text" value="<?=$j_row[j_ppfyd]?>" size="20" maxlength="10"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">品牌历史</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ppls" id="ppls" value="<?=$j_row[j_ppls]?>" type="text" size="10" maxlength="3">
            年</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">起 订 量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="qdl" id="qdl" value="<?=$j_row[j_qdl]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">发货期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fhqx" id="fhqx" value="<?=$j_row[j_fhqx]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">首次进货金额</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="scjhje" id="scjhje" value="<?=$j_row[j_scjhje]?>" type="text" size="10" maxlength="5">
            元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">供货总量</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzl" id="ghzl" value="<?=$j_row[j_ghzl]?>" type="text" size="10" maxlength="8"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">发展模式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="fzms" id="fzms" value="<?=$j_row[j_fzms]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">合作方式</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="hzfs" id="hzfs" value="<?=$j_row[j_hzfs]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">供货折扣</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="ghzk" id="ghzk"  value="<?=$j_row[j_ghzk]?>" type="text" size="10" maxlength="6">
            折</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">可换货比率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="khhbl" id="khhbl" value="<?=$j_row[j_khhbl]?>"  type="text"  size="10" maxlength="10"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">零售价格定位</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="lsjgdw" id="lsjgdw" value="<?=$j_row[j_lsjgdw]?>"  type="text" size="10" maxlength="8">
            元</TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">目标消费群体</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="mbxfqt" id="mbxfqt" value="<?=$j_row[j_mbxfqt]?>" type="text" size="15" maxlength="8"> 年龄段</TD>
          </TR>		  		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">预计回报率</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbl" id="yjhbl" value="<?=$j_row[j_yjhbl]?>" type="text" size="20" maxlength="20"></TD>
          </TR>
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">预计回报周期</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="yjhbzq" id="yjhbzq" value="<?=$j_row[j_yjhbzq]?>" type="text" size="20" maxlength="10"></TD>
          </TR>			  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">特许权使用费</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txqsyf" id="txqsyf" value="<?=$j_row[j_txqsyf]?>" type="text" size="20" maxlength="8"></TD>
          </TR>
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">合同期限</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="htqx" id="htqx"  value="<?=$j_row[j_htqx]?>" type="text" size="10" maxlength="5"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">加盟商总数</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="jmszs" id="jmszs"  value="<?=$j_row[j_jmszs]?>" type="text" size="10" maxlength="6"></TD>
          </TR>	
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">特许经营时间</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input name="txjysj" id="txjysj" value="<?=$j_row[j_txjysj]?>" type="text" size="10" maxlength="5"></TD>
          </TR>			  		  		  
		  
          <TR>
            <td height="25" align="center" bgcolor="#EFF6FF">&nbsp;</td>
            <TD bgcolor="#F9F9F9" style="padding-left:4px;"><input type="submit" value="提交">
			<input type="hidden" name="iid" value="<?=$j_row[id]?>"><input type="hidden" name="urls" value="<?=$_SERVER['HTTP_REFERER']?>">
        <INPUT type="hidden" value="ok" name="act_xg"></TD>
          </TR>
 </form>                
</TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>

</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
   if($("j_title").value==""){
      alert("标题不能为空");
      $("j_title").focus();
      return false;
   }
   if($("catalog_1").value==""){
      alert("请选择目录");
      $("catalog_1").focus();
      return false;
   }
   if($("catalog_2").value==""){
      alert("请选择二级目录");
      $("catalog_2").focus();
      return false;
   }

   if($("j_info").value==""){
      alert("描述不能为空");
      $("j_info").focus();
      return false;
   }   
}
</script>